home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d952.lha
/
MachV
/
programmer.lha
/
vars
/
list_example.c
next >
Wrap
C/C++ Source or Header
|
1993-08-07
|
2KB
|
69 lines
/* List_Example 1.0 08-07-93
Simple program to demonstrate how to open a window with a list of macro
names.
sc list_example
slink lib:c.o list_example.o lib lib:sc.lib lib:amiga.lib
*/
#include <stdio.h>
#include <ctype.h>
#include <exec/types.h>
#include <exec/libraries.h>
#include <proto/exec.h>
#include <exec/semaphores.h>
#include "/headers/mach.h"
#include "/headers/machlib.h"
#include "/headers/machlib_protos.h"
#include "/headers/machlib_pragmas.h"
struct MachLibrary *MachBase;
/* This lets you call OpenListWindow() with a variable number of tags. */
BOOL OpenListWindowTags(ULONG tags,...);
BOOL OpenListWindowTags(ULONG tags,...)
{
return(OpenListWindow((struct TagItem *)&tags));
}
main(int argc, char **argv)
{
struct TaskInfo list_task_info;
LONG listsig_nr;
ULONG list_sig;
MachBase = (struct MachLibrary*)OpenLibrary("mach.library",37L);
if (MachBase) {
if ((listsig_nr = AllocSignal(-1L)) != -1L) {
list_sig = 1 << listsig_nr;
list_task_info.Task = FindTask(NULL);
list_task_info.Sig = list_sig;
/* Open list window listing macro names */
if (OpenListWindowTags(LIST_TaskInfo, (ULONG)&list_task_info,
LIST_Type, LIST_MACRONAMES,
LIST_Title, (ULONG)"Macro Names",
TAG_DONE)) {
/* Wait for selection, ok, cancel or close window */
Wait(list_sig);
FreeSignal(listsig_nr);
if (MachBase->ml_ListSelection )
printf("Selected %s\n",MachBase->ml_ListSelection);
else
printf("No selection\n" );
}
}
CloseLibrary((struct Library*)MachBase);
}
}